<?php
$pid = get('pid');
	if(isPost()){
    	$db=getDB();
        $list = post('item');
        $db->delRow("t_page_zone",sprintf("Fpageid=%d",$pid));
        if($list){
        	foreach($list AS $id){
            	$set = array('Fpageid' => $pid);
                $set['Fzoneid'] = $id;
                $db->insertTable('t_page_zone',$set);
            }
        }
    }
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>无标题文档</title>
<link href="base.css" rel="stylesheet" type="text/css" />
</head>
<body>


<form action="?ac=pagezone&pid=<?php echo $pid;?>" method="post">
	<table  border="0" cellspacing="1" cellpadding="1">
  <tr class="trheader">
    <td>碎片名字</td>
    <td>是否开启</td>
  </tr>
  <?php
  	$db = getDB();
    $list = $db->get_results("SELECT * FROM t_zone");
    if($list){
    	foreach($list AS $row){
        	echo sprintf('<tr><td>%s</td><td><input name="item[]" type="checkbox" value="%d" /></td></tr>',$row['Fzone'],$row['Fid']);
        }
    }
  ?>
        </table>
<input name="" type="submit" />
</form>
</body>
</html>
